import 'package:development_assistant/config/db_config.dart';
import 'package:sqflite/sqlite_api.dart';
import '../model/docker_info.dart';

class DockerService{

  Database database=DBConfig.getDatabase();

  final String tableName="docker_info";

  Future getDockerList() async{
    return await database.query(tableName);
  }

  Future getDockerInfo(int? searchID) async{
    return await database.query(tableName,where:"docker_id=?",whereArgs: [searchID]);
  }

  Future addDocker(DockerInfo docker) async{
    return await database.insert(tableName, docker.toMap());
  }

  Future updateDocker(DockerInfo docker) async{
    return await database.update(tableName, docker.toMap(),where:"docker_id=?",whereArgs: [docker.dockerID]);
  }

  Future delDocker(int dockerID) async{
    return await database.delete(tableName,where:"docker_id=?",whereArgs: [dockerID]);
  }

}